package org.hyl.javabase.正则;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class p201707008 {
	public static void main(String[] arg){	 
		p201707008 p=new p201707008();
		p.fun3();
		//  System.out.println( p.gcd(5, 3));
	}
	public void fun1(){
		String model="【who】 【do】 【something】";
		
		
		String who="xiaohong";
		String doE="take";
		String something="fish";
				 
		String newstr=model
		.replace("【who】", who)
		.replaceAll("【do】", doE)
		.replaceAll("【something】", something);
		System.out.println(newstr);
	}
	

    private static final String REGEX = "\\bcat\\b";
    private static final String INPUT = "cat cat cat cattie cat";
 
    public void fun2(){
       Pattern p = Pattern.compile(REGEX);
       Matcher m = p.matcher(INPUT); // 获取 matcher 对象
       int count = 0;
 
       while(m.find()) {
         count++;
         System.out.println("Match number "+count);
         System.out.println("start(): "+m.start());
         System.out.println("end(): "+m.end());
      }
   }
    
    public void fun3(){
    	int i=3;
    	switch(i)
    	{
	    	case 5:i--;System.out.println("5："+i);
	    	case 4:i--;System.out.println("4："+i);    	
	    	case 3:i--;System.out.println("3："+i);break;
	    	case 2:i--;System.out.println("2："+i);
	    	case 1:i--;System.out.println("1："+i);
	    	default: System.out.println("other："+i);
    	
    	}
    	//if (i==3) {i--;System.out.println("3："+i);}
    	//if (i==2) {i--;System.out.println("3："+i);}
    		
    }
    
    public void fun5(){
    	channel c1=new channel('大');
    	c1
    	.addNext(new channel('中'))
    	.addNext(new channel('小'));
   
    	
    }
}
